/**
 * @file 团队管理接口
 */
import { get, post } from '@/api/request.ts';

const team = {
  // 创建新团队
  async createNewTeam(params: any) {
    return await post('/client/bus/team/create', params);
  },

  // 获取我的团队列表
  async getTeamList() {
    return await get('/client/bus/team/list-my-teams');
  },

  // 获取团队的白板列表
  async getBoardListInTeam(params: any) {
    return await get('/client/bus/board/list-boards-in-team', params);
  },

  // 获取团队成员列表
  async getTeamMemberList(params: any) {
    return await get('/client/bus/team/get-member-list', params);
  },

  // 查看 当前团队信息
  async getTeamInfo(params: any) {
    return await get('/client/bus/team/get-team-info', params);
  },

  // 修改团队名称
  async updateTeamName(params: any) {
    return await post('/client/bus/team/update', params);
  },

  // 判断当前团队是否能够解散（当且仅当 我 只有一个自己创建的团队时不可解散）
  async checkTeamCanDisband() {
    return await get('/client/bus/team/check-before-dismiss-or-transfer');
  },

  // 获取团推邀请链接
  async getTeamInviteUrl(params: any) {
    return await get('/client/bus/team/get-invite-url', params);
  },

  // 重置团队邀请链接
  async resetTeamInviteUel(params: any) {
    return await post('/client/bus/team/clear-invite-url', params);
  },

  // 查看团队邀请详情
  async getTeamInviteDetails(params: any) {
    return await get('/client/bus/team/get-invite-code-info', params);
  },

  // 使用邀请码加入团队
  async joinTeamByInviteCode(params: any) {
    return await get('/client/bus/team/join-by-invite-code', params);
  },

  // 解散团队
  async disbandTeam(params: any) {
    return await post('/client/bus/team/dismiss', params);
  },

  // 移交团队（仅团队拥有者操作）
  async transferTeam(params: any) {
    return await post('/client/bus/team/transfer', params);
  },

  // 移除团队成员（仅团队拥有者操作）
  async removeMember(params: any) {
    return await post('/client/bus/team/remove-member', params);
  },

  // 退出团队
  async quitTeam(params: any) {
    return await post('/client/bus/team/quit', params);
  },
};

export default team;
